package com.yixia.system.service.impl.system;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yixia.system.domain.system.SysLogininfor;
import com.yixia.system.mapper.system.SysLogininforMapper;
import com.yixia.system.service.system.SysLogininforService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: yimeng
 */

@Service
public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, SysLogininfor>
        implements SysLogininforService {


    @Autowired
    private SysLogininforMapper logininforMapper;

    /**
     * 新增系统登录日志
     *
     * @return
     */
    @Override
    public int insertLogininfor(SysLogininfor logininfor) {
        return logininforMapper.insertLogininfor(logininfor);
    }

    @Override
    public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor) {
       // 进行分页查询
        return logininforMapper.selectLogininforList(logininfor);
    }

    @Override
    public int deleteLogininforByIds(Long[] infoIds) {
        return logininforMapper.deleteLogininforByIds(infoIds);
    }

    @Override
    public void cleanLogininfor() {
        logininforMapper.cleanLogininfor();
    }


    /**
     * 系统访问量
     * @return 结果
     */
    @Override
    public int selectCount(){
        return Math.toIntExact(logininforMapper.selectCount(new LambdaQueryWrapper<>()));
    }
}
